<html>
<head><meta charset="utf-8"><title>Add `TyKind::Const` and remove `GenericAr… compiler-team#453 · t-compiler/major changes · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/index.html">t-compiler/major changes</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html">Add `TyKind::Const` and remove `GenericAr… compiler-team#453</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="248479604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248479604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248479604">(Aug 05 2021 at 13:51)</a>:</h4>
<p>A new proposal has been announced: <a href="https://github.com/rust-lang/compiler-team/issues/453">Add <code>TyKind::Const</code> and remove <code>GenericArgKind::Const</code> #453</a>. It will be announced at the next meeting to try and draw attention to it, but usually MCPs are not discussed during triage meetings. If you think this would benefit from discussion amongst the team, consider proposing a design meeting.</p>



<a name="248479689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248479689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248479689">(Aug 05 2021 at 13:52)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="326189">@jknodt</span></p>



<a name="248480574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248480574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248480574">(Aug 05 2021 at 13:59)</a>:</h4>
<blockquote>
<p>The order of constants coming after types in generic arguments is already being removed, this makes it truly irrelevant.</p>
</blockquote>
<p>I don't think this is really true <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> we still have 2 kinds of parameters, one accepting all types except <code>TyKind::Const</code> and one accepting only <code>TyKind::Const</code></p>



<a name="248480964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248480964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248480964">(Aug 05 2021 at 14:01)</a>:</h4>
<p>behind a feature gate, right?</p>



<a name="248481048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248481048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248481048">(Aug 05 2021 at 14:02)</a>:</h4>
<blockquote>
<p>Treating them the same requires less duplication of logic</p>
</blockquote>
<p>do you have some concrete ideas where we can simplify the logic thanks to this change? Thinking about the areas I am working on rn, I don't see how this change would have a meaningful impact there</p>



<a name="248481165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248481165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248481165">(Aug 05 2021 at 14:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453/near/248480964">said</a>:</p>
<blockquote>
<p>behind a feature gate, right?</p>
</blockquote>
<p>loosening the order restriction is behind a feature gate rn (and ready for stabilization afaik, it's just that noone pushed for it)</p>



<a name="248481345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248481345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248481345">(Aug 05 2021 at 14:04)</a>:</h4>
<p>having two different kind of parameters (types <code>T</code> and consts <code>const N: usize</code>) does not depend on the order of params, which is my concern here</p>



<a name="248482535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248482535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248482535">(Aug 05 2021 at 14:12)</a>:</h4>
<blockquote>
<p>It feels very neat from a type system perspective</p>
</blockquote>
<p>the way I see this is that types are values of the kind <code>Type</code> while consts are values of their type. So unless we can use type to represent kinds containing the kind <code>Type</code>. I don't see much theoretical niceness from this change as long as <code>TyKind</code> can only represent the kind <code>Type</code> (and values with this change)</p>



<a name="248482851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248482851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248482851">(Aug 05 2021 at 14:15)</a>:</h4>
<p>do you also want to introduce <code>TyKind::Lifetime</code>? seems like that has similar tradeoffs</p>



<a name="248483882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248483882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248483882">(Aug 05 2021 at 14:22)</a>:</h4>
<ul>
<li><a href="https://github.com/rust-lang/rust/issues/87648">#87648</a> would not have to add a second comparison scheme at all</li>
<li>The following uses of <code>GenericArgKind::Const</code> are an almost literal copy of the <code>::Type</code> arm or would trivially be handled by the <code>::Type</code> arm<br>
    * <a href="https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_infer/src/infer/canonical/query_response.rs#L278">https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_infer/src/infer/canonical/query_response.rs#L278</a><br>
    * <a href="https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_infer/src/infer/canonical/query_response.rs#L576">https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_infer/src/infer/canonical/query_response.rs#L576</a><br>
    * <a href="https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_infer/src/infer/outlives/verify.rs#L199">https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_infer/src/infer/outlives/verify.rs#L199</a><br>
    * <a href="https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_infer/src/infer/outlives/verify.rs#L63">https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_infer/src/infer/outlives/verify.rs#L63</a><br>
    * <a href="https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_middle/src/ty/relate.rs#L748">https://github.com/rust-lang/rust/blob/e21e1d6a417330af5f4693004230fd0efdf9445a/compiler/rustc_middle/src/ty/relate.rs#L748</a></li>
<li><code>ConstKind::Infer</code>, <code>::Bound</code> and <code>::Param</code> could probably just become the <code>TyKind</code> equivalents, which accounts for all of the other uses of <code>GenericArgKind::Const</code> that aren't just ignoring the argument or are just empty arms.</li>
</ul>



<a name="248483971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248483971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248483971">(Aug 05 2021 at 14:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink  [he/him]</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453/near/248482851">said</a>:</p>
<blockquote>
<p>do you also want to introduce <code>TyKind::Lifetime</code>? seems like that has similar tradeoffs</p>
</blockquote>
<p>lifetimes are different, they don't participate in trait resolution or codegen</p>



<a name="248484284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248484284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248484284">(Aug 05 2021 at 14:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453/near/248482535">said</a>:</p>
<blockquote>
<blockquote>
<p>It feels very neat from a type system perspective</p>
</blockquote>
<p>the way I see this is that types are values of the kind <code>Type</code> while consts are values of their type. So unless we can use type to represent kinds containing the kind <code>Type</code>. I don't see much theoretical niceness from this change as long as <code>TyKind</code> can only represent the kind <code>Type</code> (and values with this change)</p>
</blockquote>
<p>hmm... Maybe I'm too much of a fan of <code>typenum</code>, but being able to encode arbitrary constants in the type system kind of already makes them types. This just makes it first class.</p>



<a name="248486735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248486735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248486735">(Aug 05 2021 at 14:42)</a>:</h4>
<p>hmm, I agree that type and constant arguments often end up with exactly the same treatment, and I was also annoyed by that in the past. Didn't think about these cases</p>



<a name="248486787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248486787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248486787">(Aug 05 2021 at 14:42)</a>:</h4>
<p>another example for stuff like that are <code>WellFormed</code> predicates, which do contain a <code>GenericArg</code> but are noops for lifetimes</p>



<a name="248486869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248486869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248486869">(Aug 05 2021 at 14:43)</a>:</h4>
<p>I would like to have some kind of <code>enum TyOrConst</code> as a <code>GenericArgKind</code> (or at least try that out)</p>



<a name="248487392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248487392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248487392">(Aug 05 2021 at 14:46)</a>:</h4>
<p>having <code>TyKind::Const</code> still doesn't feel great for me though <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> parts of this might be me disliking change though</p>



<a name="248487979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248487979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248487979">(Aug 05 2021 at 14:50)</a>:</h4>
<blockquote>
<p>kind of already makes them types</p>
</blockquote>
<p>that's probably where our mental models differ, because for me, even if you can encode integers as types, their kind is still <code>Type</code>. Using associated consts you can convert these types into arbitrary integers but imo requiring this step matters</p>



<a name="248489010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248489010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248489010">(Aug 05 2021 at 14:56)</a>:</h4>
<div class="spoiler-block"><div class="spoiler-header">
</div><div class="spoiler-content" aria-hidden="true">
<blockquote>
<p>People may get motivated to push for features like <code>impl Trait for 42 {}</code> or <code>let x: 42</code> ZST types</p>
</blockquote>
<p>now that's a reason for me to reject this MCP :p</p>
</div></div>



<a name="248494185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248494185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248494185">(Aug 05 2021 at 15:32)</a>:</h4>
<p>Re: spoiler, I would expect people to ask for that regardless of this change <em>and</em> this change wouldn't have any user visible changes. We could in theory change back and forth every other release to use the current approach or the unified approach and <em>nothing should change</em> other than how annoyed us as maintainers would be, right?</p>



<a name="248494304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248494304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248494304">(Aug 05 2021 at 15:33)</a>:</h4>
<p>I'm in favor of the change (although I don't mind too much either way enough to go running head first into a flamewar <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span>)</p>



<a name="248496100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248496100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248496100">(Aug 05 2021 at 15:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453/near/248487979">said</a>:</p>
<blockquote>
<p>that's probably where our mental models differ, because for me, even if you can encode integers as types, their kind is still <code>Type</code>. Using associated consts you can convert these types into arbitrary integers but imo requiring this step matters</p>
</blockquote>
<p>yea... my model literally considers consts to be a type, and the fact that you can encode them is just "proof"</p>



<a name="248496211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248496211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248496211">(Aug 05 2021 at 15:47)</a>:</h4>
<p>I am aware how close I am in "everything is a tuple" territory, but... I like constants, a lot. They are the reason I work on rustc lol</p>



<a name="248567152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248567152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248567152">(Aug 06 2021 at 03:29)</a>:</h4>
<p>I have got an idea for some time that maybe there could be a user-facing const generic type? Then the syntax could be lowered into something around this.</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[lang = </span><span class="s">"phantom_const"</span><span class="cp">]</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">PhantomConst</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">V</span>: <span class="nc">T</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">V</span>: <span class="nc">T</span><span class="o">&gt;</span><span class="w"> </span><span class="n">PhantomConst</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">      </span><span class="k">type</span> <span class="nc">Type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="p">;</span><span class="w"></span>
<span class="w">      </span><span class="k">const</span><span class="w"> </span><span class="n">VALUE</span>: <span class="nc">T</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">V</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248590968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248590968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248590968">(Aug 06 2021 at 09:55)</a>:</h4>
<p>Yea, I would like to keep this out of user-facing space for now, but <code>PhantomConst</code> is certainly one good (possibly the best) way to represent it</p>



<a name="248608822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248608822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248608822">(Aug 06 2021 at 13:16)</a>:</h4>
<blockquote>
<p>Const generics are (modulo syntax-level features) essentially equivalent to types </p>
</blockquote>
<p>I, uh, have a <em>lot</em> of disagreement with that statement.^^</p>



<a name="248608852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248608852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248608852">(Aug 06 2021 at 13:17)</a>:</h4>
<p>types classify values. const generics don't. so really they are fundamentally completely different beasts.</p>



<a name="248608977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248608977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248608977">(Aug 06 2021 at 13:17)</a>:</h4>
<p>if Rust had dependent types I might agree with statements saying that types are basically also just constants (of type <code>Type</code>), but that would lead to a pretty different system I think</p>



<a name="248612186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612186">(Aug 06 2021 at 13:42)</a>:</h4>
<p>How is <code>PhantomConst</code> different from having constants directly as types?</p>



<a name="248612285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612285">(Aug 06 2021 at 13:43)</a>:</h4>
<p>how does it have anything to do with that?</p>



<a name="248612321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612321">(Aug 06 2021 at 13:43)</a>:</h4>
<p>"having constant as types" just errors in my mental parser, it's a category error for me</p>



<a name="248612334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612334">(Aug 06 2021 at 13:43)</a>:</h4>
<p>so I cant even really make sense of the question^^</p>



<a name="248612356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612356">(Aug 06 2021 at 13:43)</a>:</h4>
<p>"having types as constants" would make a lot more sense :D</p>



<a name="248612481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612481">(Aug 06 2021 at 13:44)</a>:</h4>
<p>a constant is a <em>value</em>, a type is not...</p>



<a name="248612529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612529">(Aug 06 2021 at 13:45)</a>:</h4>
<p>a type describes sets of values (or more complicated things)</p>



<a name="248612567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612567">(Aug 06 2021 at 13:45)</a>:</h4>
<p>a type has invariants (validity invariant, safety invariant) and a public API</p>



<a name="248612576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612576">(Aug 06 2021 at 13:45)</a>:</h4>
<p>constants dont do any of that</p>



<a name="248612747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612747">(Aug 06 2021 at 13:47)</a>:</h4>
<p>Just like the unit type and its value are essentially interchangeable, so would a constant and its ZST type be</p>



<a name="248612891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612891">(Aug 06 2021 at 13:48)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453/near/248612285">said</a>:</p>
<blockquote>
<p>how does it have anything to do with that?</p>
</blockquote>
<p>it is exactly what I'm proposing, just without the language-level representation</p>



<a name="248612915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248612915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248612915">(Aug 06 2021 at 13:48)</a>:</h4>
<p>I just want the compiler to process it as such</p>



<a name="248613029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248613029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248613029">(Aug 06 2021 at 13:49)</a>:</h4>
<p>all possible language things are interesting, but not relevant here. I just want the compiler to internally not differentiate constants and types beyond the fact that it essentially now has a built in <code>PhantomConst</code> type</p>



<a name="248615484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615484">(Aug 06 2021 at 14:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453/near/248612747">said</a>:</p>
<blockquote>
<p>Just like the unit type and its value are essentially interchangeable, so would a constant and its ZST type be</p>
</blockquote>
<p>uh... no they are not,  they are completely different things^^</p>



<a name="248615501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615501">(Aug 06 2021 at 14:08)</a>:</h4>
<p>even with a dependent type lense this statement makes just no sense at all IMO</p>



<a name="248615532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615532">(Aug 06 2021 at 14:09)</a>:</h4>
<p>the term <code>tt</code> has type <code>()</code>, the term <code>()</code> has type <code>Type</code></p>



<a name="248615549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615549">(Aug 06 2021 at 14:09)</a>:</h4>
<p>they are not the same thing by even the most extreme stretch of the imagination</p>



<a name="248615772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615772">(Aug 06 2021 at 14:11)</a>:</h4>
<p>I have a good imagination and a really good lack of PLT</p>



<a name="248615793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615793">(Aug 06 2021 at 14:11)</a>:</h4>
<p>of course once you have things of kind <code>const → type</code>, you can "inject" constants into types. we can do the same with lifetimes though:</p>
<div class="codehilite"><pre><span></span><code>struct PhantomLifetime&lt;&#39;a&gt;(&amp;&#39;a ());
</code></pre></div>



<a name="248615802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615802">(Aug 06 2021 at 14:11)</a>:</h4>
<p>so, consts and types are the same thing only as much as lifetimes and types are the same thing</p>



<a name="248615892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615892">(Aug 06 2021 at 14:12)</a>:</h4>
<p>lifetimes don't participate in trait resolution or codegen</p>



<a name="248615914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615914">(Aug 06 2021 at 14:12)</a>:</h4>
<p>(and usually when A injects into B we dont say they are the same thing)</p>



<a name="248615941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615941">(Aug 06 2021 at 14:12)</a>:</h4>
<p>constant and type parameters behave the same, lifetime parameters are different</p>



<a name="248615942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615942">(Aug 06 2021 at 14:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453/near/248615892">said</a>:</p>
<blockquote>
<p>lifetimes don't participate in trait resolution or codegen</p>
</blockquote>
<p>I dont see how thats even relevant</p>



<a name="248615966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615966">(Aug 06 2021 at 14:12)</a>:</h4>
<p>also AFAIK trait bounds like <code>Foo&lt;'a, 'a&gt;</code> are possible and then they to participate in trait resolution</p>



<a name="248615973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248615973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248615973">(Aug 06 2021 at 14:12)</a>:</h4>
<p>or <code>Foo&lt;'static&gt;</code></p>



<a name="248616005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616005">(Aug 06 2021 at 14:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453/near/248615941">said</a>:</p>
<blockquote>
<p>constant and type parameters behave the same, lifetime parameters are different</p>
</blockquote>
<p>your notion of "behave" must be radically different from mine^^</p>



<a name="248616086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616086">(Aug 06 2021 at 14:13)</a>:</h4>
<p>if this is just an internal thing that a user will never ever see, maybe its okay -- but you should still be aware that your terminology is extremely non-standard and confusing</p>



<a name="248616090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616090">(Aug 06 2021 at 14:13)</a>:</h4>
<p>to me const generics are just prettier <code>typenum</code>, which is fully defined in the type system</p>



<a name="248616241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616241">(Aug 06 2021 at 14:14)</a>:</h4>
<p>all the confusing stuff came in this thread once other things got munched into my internal refactoring idea <span aria-label="stuck out tongue" class="emoji emoji-1f61b" role="img" title="stuck out tongue">:stuck_out_tongue:</span></p>



<a name="248616311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616311">(Aug 06 2021 at 14:15)</a>:</h4>
<p>the issue also already lists several things that clearly show that consts are not types -- like the various bits of the code that need to add nonsense <code>ty::Const</code> arms to their <code>match</code>es</p>



<a name="248616382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616382">(Aug 06 2021 at 14:16)</a>:</h4>
<p>we already have such nonsense arms for the other magic internal <code>TyKind</code> variants</p>



<a name="248616432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616432">(Aug 06 2021 at 14:16)</a>:</h4>
<p>and it'll mostly be just another arm to that fallback list</p>



<a name="248616499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616499">(Aug 06 2021 at 14:16)</a>:</h4>
<p>Rust has 3 "kinds of terms" in the type system: type, lifetime, const. We currently treat them nicely separately so we get some type safety (in the meta language) when dealing with them. I think you are saying that meta-level type safety is not buying us enough and we should just give up on it and make the type system "untyped" (or at least "less typed") from the meta language perspective.</p>



<a name="248616570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616570">(Aug 06 2021 at 14:17)</a>:</h4>
<p>but there is no principled way in which this can be justified IMO, and the fact that lifetimes are still different is an ad-hoc implementation artifact, nothing meaningful</p>



<a name="248616674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616674">(Aug 06 2021 at 14:18)</a>:</h4>
<p>(by meta language here I mean the host rustc that is implementing the type system but itself written in Rust as well)</p>



<a name="248616752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616752">(Aug 06 2021 at 14:19)</a>:</h4>
<p>we already have such "optimizations". For all intents and purposes <code>bool</code> is just <code>enum bool { true, false }</code>, but we keep it as a custom type</p>



<a name="248616911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616911">(Aug 06 2021 at 14:20)</a>:</h4>
<p>the compiler could use more general representations of lots of things. I'm essentially proposing to move <code>typenum</code> types into a custom <code>TyKind</code> variant to make some things simpler in the compiler</p>



<a name="248616924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616924">(Aug 06 2021 at 14:20)</a>:</h4>
<p>In Haskell there are higher-ranked types. Basically type parameters have a "rank" that determines what kind of thing you can put in the type parameter. The rank <code>*</code> corresponds to a regular type like <code>Option&lt;u8&gt;</code>, while say <code>* -&gt; *</code> corresponds to a type constructor like <code>Option</code>. Constraints (where clauses) also have a rank (<code>GHC.Prim.Constraint</code>). And finally types are valid ranks. This basically corresponds to const generics in rust.</p>



<a name="248616983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248616983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248616983">(Aug 06 2021 at 14:21)</a>:</h4>
<p>I think <code>*</code> and <code>* → *</code> and the like are usually called "kinds", not "ranks"</p>



<a name="248617007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617007">(Aug 06 2021 at 14:21)</a>:</h4>
<p>(and that's how I used the term "kind" as well above)</p>



<a name="248617037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617037">(Aug 06 2021 at 14:21)</a>:</h4>
<p>I think you are right. My bad.</p>



<a name="248617041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617041">(Aug 06 2021 at 14:21)</a>:</h4>
<p>haskell <code>*</code> corresponds to what I called <code>type</code>/<code>Type</code> above</p>



<a name="248617077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617077">(Aug 06 2021 at 14:22)</a>:</h4>
<p>and no they dont correspond to const generics at all</p>



<a name="248617126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617126">(Aug 06 2021 at 14:22)</a>:</h4>
<p>const generics would be of kind <code>const</code></p>



<a name="248617153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617153">(Aug 06 2021 at 14:22)</a>:</h4>
<p>and e.g. the array type constructor would be of kind <code>* -&gt; const -&gt; *</code></p>



<a name="248617181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617181">(Aug 06 2021 at 14:22)</a>:</h4>
<p>i.e., const generics introduce a new "primitive kind" besides <code>*</code></p>



<a name="248617191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617191">(Aug 06 2021 at 14:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453/near/248617126">said</a>:</p>
<blockquote>
<p>const generics would be of kind <code>const</code></p>
</blockquote>
<p>isn't it of kind <em>its type</em></p>



<a name="248617194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617194">(Aug 06 2021 at 14:22)</a>:</h4>
<p>Rust already has two of those: <code>Type</code> and <code>Lifetime</code></p>



<a name="248617214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617214">(Aug 06 2021 at 14:22)</a>:</h4>
<p>array is <code>* -&gt; usize -&gt; *</code> <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="248617250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617250">(Aug 06 2021 at 14:23)</a>:</h4>
<p>well if we want to go full dependent types we could describe it like that as well, yes</p>



<a name="248617270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617270">(Aug 06 2021 at 14:23)</a>:</h4>
<p>I was going to keep a stratification between types and kinds</p>



<a name="248617532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617532">(Aug 06 2021 at 14:25)</a>:</h4>
<p>that's why I said from the beginning that treating types like a particular kind of consts (namely conts of type <code>Type</code>) makes some theoretic sense</p>



<a name="248617539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617539">(Aug 06 2021 at 14:25)</a>:</h4>
<p>but not the other way around</p>



<a name="248617831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248617831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248617831">(Aug 06 2021 at 14:27)</a>:</h4>
<p>my work week is almost over XD see you all monday. I'll ponder on this a bit</p>



<a name="248618097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248618097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248618097">(Aug 06 2021 at 14:29)</a>:</h4>
<p>my weekend just begins, so perfect time to discuss this ;) but I see what you mean</p>



<a name="248618131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248618131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248618131">(Aug 06 2021 at 14:30)</a>:</h4>
<p>during the week I just need to work, is the thing...^^</p>



<a name="248619117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Add%20%60TyKind%3A%3AConst%60%20and%20remove%20%60GenericAr%E2%80%A6%20compiler-team%23453/near/248619117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Add.20.60TyKind.3A.3AConst.60.20and.20remove.20.60GenericAr.E2.80.A6.20compiler-team.23453.html#248619117">(Aug 06 2021 at 14:38)</a>:</h4>
<p>I'll try to find some time then <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>